<%--@elvariable id="storeId" type=""--%>
<%--@elvariable id="flag" type=""--%>
<%--@elvariable id="dishName" type=""--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>点赞</title>
    <style>
        div {
            position: absolute;
            top: 30%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }

        table, tr, th, td {
            border: 1px solid #5fbdcb;
        }

        table {
            border-collapse: collapse;
        }
    </style>
</head>
<body>
<div>
    <form action="${pageContext.request.contextPath}/thumb.do?method=selectThumb" method="post" hidden>
        <label for="flag"></label><input type="text" id="flag" value="${flag}" hidden>
        <input type="submit" id="button" hidden>
    </form>
    <table>
        <tr>
            <th>菜品名</th>
            <th>价格</th>
            <th>描述</th>
            <th>照片</th>
            <th></th>
        </tr>
        <%--@elvariable id="dishes" type="java.util.List"--%>
        <c:forEach var="dish" items="${dishes}">
            <tr>
                <td>
                        ${dish.dishName}
                </td>
                <td>
                        ${dish.price}
                </td>
                <td>
                        ${dish.describe}
                </td>
                <td>
                    <img src="/photo/${dish.dishId}.jpg" alt="${dish.dishId}照片" width="100px">
                </td>
                <td>
                    <a href="${pageContext.request.contextPath}/User/CancelThumb.jsp?dishId=${dish.dishId}">取消点赞</a>
                </td>
            </tr>
        </c:forEach>
    </table>
    <br>
    <a href="${pageContext.request.contextPath}/User/UserPage.jsp">返回</a>
</div>
<script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script>
    let element = document.querySelector('#flag');
    let element1 = document.querySelector('#button');
    if (element.value === "") {
        element1.click();
    }
</script>
</body>
</html>
